package com.xxx.test;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import com.xxx.DAO.booksDao;

@WebServlet("/addBook")
public class addBook extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String bName=new String(request.getParameter("bName").getBytes("UTF-8"),"UTF-8");
        String bAut=new String(request.getParameter("bAut").getBytes("UTF-8"),"UTF-8");
        String bPub=new String(request.getParameter("bPub").getBytes("UTF-8"),"UTF-8");
        int bSum= Integer.parseInt(request.getParameter("bSum"));
        String path=new String(request.getParameter("path").getBytes("UTF-8"),"UTF-8");
        booksDao dao=new booksDao();
        dao.add(bName,bAut,bPub,bSum,path);
        request.getRequestDispatcher("showTable2").forward(request,response);

    }
}
